import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;

public class SolutionInterview16_15 {
    public int[] masterMind(String solution, String guess) {
        Map<Character,Integer> map=new HashMap<>();
        map.put('R',0);
        map.put('G',1);
        map.put('B',2);
        map.put('Y',3);
        int[] f=new int[4];
        int[] g=new int[4];
        int ans1=0;
        for (int i=0;i<solution.length();i++){
            if (solution.charAt(i)==guess.charAt(i)){
                ans1++;
            }else {
                f[map.get(solution.charAt(i))]++;
                g[map.get(guess.charAt(i))]++;
            }
        }
        int ans2=0;
        for (int i=0;i<4;i++){
            ans2+=Math.min(f[i],g[i]);
        }
        return new int[]{ans1,ans2};
    }

    public static void main(String[] args) {
        System.out.println(Arrays.toString(new SolutionInterview16_15().masterMind("RGBY", "GGRR")));
    }
}
